Skip to content

markdown, components: images in MarkdownView from host bitmaps - #4

Merged
1lck merged 1 commit into
mainfrom
feat/markdown-images
Nov 11, 2026
Merged

1lck merged 1 commit into
mainfrom
feat/markdown-images

Conversation

@1lck

@1lck 1lck commented Nov 11, 2026

Copy link
Copy Markdown

Implements the API proposed in vivaui#220 in our fork:

  • markdown.Span.Image holds an image's destination as written (![alt](dest)); Text is the alt text. A linked badge keeps its Link.
  • components.MarkdownStyle.Image func(destination string) (gfx.Bitmap, bool) resolves bitmaps; images lay out inline, scaled down to the column and never up. A line is as tall as its tallest image, and the image is painted with DrawBitmap. Without a resolver, or when it returns false, the alt text shows as before.

Tests: go test ./markdown ./components -run Image.

🤖 Generated with Claude Code

The parser makes ![alt](destination) a Span whose Image is the
destination as written. MarkdownStyle.Image asks the application for
each image's bitmap; the view lays it out inline, scaled down to the
column and never up, makes a line as tall as its tallest image, keeps a
linked image a link, and paints it. Without a bitmap the alt text shows,
as before. The framework never reads files or the network.

Closes the need of vivaui#220 in this fork.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@1lck
1lck merged commit cdf0039 into main Nov 11, 2026
1lck added a commit to 1lck/Lithe-IDEA that referenced this pull request Nov 11, 2026
Viva's MarkdownView lays out images from bitmaps the application hands
it (Lithe-IDEA/Lithe-viva#4). The preview resolves a destination relative to
the file, or downloads an http(s) address through the proxy policy,
decodes it off the window thread within the viewer's limits, and lays
the page out again when it arrives; until then, and for formats the
standard decoders do not read (SVG), the alt text shows. A linked badge
stays a link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant